statefiles: fix escape sequence for broken hostname output
authorKevin Darbyshire-Bryant <[email protected]>
Fri, 5 Dec 2025 08:09:14 +0000 (08:09 +0000)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 9 Dec 2025 15:07:14 +0000 (16:07 +0100)
Broken hostnames are being reported as "broken\x20-"
instead of "broken -" which I'm guessing is what was
intended.

Signed-off-by: Kevin Darbyshire-Bryant <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/340
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/statefiles.c

index ffca35553a9669e0802441e79c95a9a6942e5b68..f16e04d92e39efd64beb77ce5162f36913f0fc94 100644 (file)
@@ -189,7 +189,7 @@ static void statefiles_write_state6(struct write_ctxt *ctxt, struct dhcpv6_lease
                fprintf(ctxt->fp,
                        "# %s %s %x %s%s %" PRId64 " %" PRIx64 " %" PRIu8,
                        ctxt->iface->ifname, duidbuf, ntohl(lease->iaid),
-                       lease->hostname_valid ? "" : "broken\\x20",
+                       lease->hostname_valid ? "" : "broken\x20",
                        lease->hostname ? lease->hostname : "-",
                        (lease->valid_until > ctxt->now ?
                         (int64_t)(lease->valid_until - ctxt->now + ctxt->wall_time) :
@@ -225,7 +225,7 @@ static void statefiles_write_state4(struct write_ctxt *ctxt, struct dhcpv4_lease
                "# %s %s ipv4 %s%s %" PRId64 " %x 32 %s/32\n",
                ctxt->iface->ifname,
                ether_ntoa((struct ether_addr *)lease->hwaddr),
-               lease->hostname_valid ? "" : "broken\\x20",
+               lease->hostname_valid ? "" : "broken\x20",
                lease->hostname ? lease->hostname : "-",
                (lease->valid_until > ctxt->now ?
                 (int64_t)(lease->valid_until - ctxt->now + ctxt->wall_time) :